#include <iostream>
#include <cstdlib>
#include <ctype.h>
#include <string>
#include <stack>
#include <queue>

using namespace std;

void Error(int err)
{
    switch (err)
    {
    case 1:
        std::cout << "Error." << endl;
        break;
    case 2:
        std::cout << "Error. 0 can't be denominator." <<endl;
    
    default:
        std::cout << "Unknown Error." <<endl;
        break;
    }
}

///返回运算符优先级
int priority(char op)
{
    switch (op)
    {
    case '+':case '-': return 2;
    case '*':case '/': return 3;
    case '(':return 1;
    default:return 0;
    }
}

///calculate one step
double calonce(double x, double y, char op)
{
    switch (op)
    {
    case '+': return x+y;
    case '-': return x-y;
    case '*': return x*y;
    case '/': 
        if(y) 
            return x/y; 
        else 
            Error(2);
            return 0;

    default:
        break;
    }
}

int main()
{
    ///read an expression
    char ch;
    queue<char> exp;
    while((ch = cin.get()) != '\n')
    {
        exp.push(ch);
    }

    ///把表达式字符串转换成数字和运算符
    stack<char> op;
    stack<double> num;
    string cache;    //store digit
    double temp,x,y;
    int err = 0;
    int dot = 0;     //0 accept dot when 1 don't
    int mod = 0;     //0 accept minus when 1 don't

    while(!exp.empty())
    {
        ch = exp.front();
        exp.pop();
        
        if(ch == '-' && mod == 0) ///处理负号
        {
            cache += ch;
            mod = 1;
            continue;
        }else if(isdigit(ch))
        {
            cache += ch;
            mod = 1;
            continue;
        }
        else if(ch == '.')
        {
            if(dot) err = 1;
            else cache += ch;
            dot = 1;
            continue;
        }else if(ch == '(')
        {
            op.push(ch);
            continue;
        }
        
        if(priority(ch))
        {
            if(!cache.empty())
            {
                temp = atof(cache.c_str());
                num.push(temp);
                cache.clear();
            }
            dot = 0; mod = 0;///归位
            if(op.empty() || priority(op.top()) < priority(ch) )
            {
                op.push(ch);
            }else if(priority(op.top()) >= priority(ch))
            {
                while (!op.empty() && op.top() != '(' && priority(op.top()) >= priority(ch))
                {
                    y = num.top(); num.pop();
                    x = num.top(); num.pop();
                    temp = calonce(x,y,op.top());
                    op.pop();
                    num.push(temp);
                }
                op.push(ch);
            }
        }else if(ch == ')')
            {
                if(!cache.empty())
                {
                    temp = atof(cache.c_str());
                    num.push(temp);
                    cache.clear();
                }
                while(op.top() != '(')
                {
                    y = num.top(); num.pop();
                    x = num.top(); num.pop();
                    temp = calonce(x,y,op.top());
                    op.pop();
                    num.push(temp);
                }
                op.pop();
            }
    }

    //when stack op 还有剩余
    temp = atof(cache.c_str());
        num.push(temp);
        cache.clear();
    while(!op.empty())
    {
        y = num.top(); num.pop();
        x = num.top(); num.pop();
        temp = calonce(x,y,op.top());
        op.pop();
        num.push(temp);
    }

    if(err)
    {
        Error(err);
    }else
    {
        std::cout << "This is the result." << endl;
        std::cout << num.top() <<endl;
        std::cout << "Thanks for use." << endl; 
    }
    
    return 0;
}
